﻿using UnityEngine;

using System;
using System.Linq;
using System.Collections.Generic;

namespace Hont.UMotionGraph
{
    public struct Sphere
    {
        public Vector3 Center { get; set; }
        public float Radius { get; set; }


        public Sphere(Vector3 center, float radius)
            : this()
        {
            this.Center = center;
            this.Radius = radius;
        }

        public bool Contain(Vector3 pos)
        {
            float x = Math.Abs(this.Center.x - pos.x);
            float y = Math.Abs(this.Center.y - pos.y);
            float z = Math.Abs(this.Center.z - pos.z);
            return x * x + y * y + z * z <= Radius * Radius;
        }
    }
}